home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / util2 / vol12n11.zip / OLFONT.ZIP / OLFFILL.C < prev    next >
C/C++ Source or Header  |  1993-04-04  |  2KB  |  62 lines

  1. /*----------------------------------------
  2.    OLFFILL.C -- Filled OS/2 Outline Font
  3.                 (c) Charles Petzold, 1993
  4.   ----------------------------------------*/
  5.  
  6. #define INCL_WIN
  7. #define INCL_GPI
  8. #include <os2.h>
  9. #include <string.h>
  10. #include "olf.h"
  11.  
  12. #define LCID_FONT    1
  13.  
  14. void PaintClient (HPS hps, SHORT cxClient, SHORT cyClient)
  15.      {
  16.      static CHAR szText [] = "Hello!" ;
  17.      POINTL      ptl, aptlTextBox [TXTBOX_COUNT] ;
  18.  
  19.           // Create and size the logical font
  20.  
  21.      CreateOutlineFont (hps, LCID_FONT, "Times New Roman Italic", 0, 0) ;
  22.      GpiSetCharSet (hps, LCID_FONT) ;
  23.      ScaleOutlineFont (hps, 1440, 1440) ;
  24.  
  25.           // Get the text box
  26.  
  27.      GpiQueryTextBox (hps, strlen (szText), szText,
  28.                       TXTBOX_COUNT, aptlTextBox) ;
  29.  
  30.           // Create the path
  31.  
  32.      GpiBeginPath (hps, 1) ;
  33.  
  34.      ptl.x = (cxClient - aptlTextBox [TXTBOX_CONCAT].x) / 2 ;
  35.      ptl.y = (cyClient - aptlTextBox [TXTBOX_TOPLEFT].y
  36.                        - aptlTextBox [TXTBOX_BOTTOMLEFT].y) / 2 ;
  37.  
  38.      GpiCharStringAt (hps, &ptl, strlen (szText), szText) ;
  39.  
  40.      GpiEndPath (hps) ;
  41.  
  42.           // Fill the path
  43.  
  44.      GpiSetPattern (hps, PATSYM_HATCH) ;
  45.      GpiFillPath (hps, 1, 0) ;
  46.  
  47.           // Create the path again
  48.  
  49.      GpiBeginPath (hps, 1) ;
  50.      GpiCharStringAt (hps, &ptl, strlen (szText), szText) ;
  51.      GpiEndPath (hps) ;
  52.  
  53.           // Outline the path
  54.  
  55.      GpiOutlinePath (hps, 1, 0) ;
  56.  
  57.           // Select the default font; delete the logical font
  58.  
  59.      GpiSetCharSet (hps, LCID_DEFAULT) ;
  60.      GpiDeleteSetId (hps, LCID_FONT) ;
  61.      }
  62.